package com.jffccloud.common.redis;

import java.util.Map;

public interface IJedisClient {
    public void set(Object key, Object value);

    // 给某个key设值
    public void set(Object key, Object value, int expireTime);

    // 根据key获取value
    public Object get(Object key);

    // 根据键值获取value
    public Object hashGet(Object key, String field);

    public void hashSet(Object key, String field, Object value);

    public Map<String, Object> hashAllGet(Object key);

    // 判断key是否存在
    public boolean existKey(Object key);

    // 删除
    public void delKey(Object key);

    /**
     * 加分布式锁
     *
     * @param lockKey
     * @param lockValue
     * @param expireTime
     * @return
     */
    public boolean tryGetDistributedLock(String lockKey, String lockValue, int expireTime);

    /**
     * 解分布式锁
     *
     * @param lockKey
     * @param lockValue
     * @return
     */
    public boolean releaseDistributedLock(String lockKey, String lockValue);
}
